package http.secure.common.config;

import http.secure.common.keys.SecureGuidSession;
import jakarta.servlet.http.HttpSession;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Slf4j
@Configuration
public class SessionGuidConfiguration {
    @Bean
    @ConditionalOnMissingBean
    @ConditionalOnWebApplication
    public SecureGuidSession guidSessionSupport(HttpSession session) {
        log.info("HttpSession Id GUID is enable");
        return session::getId;
    }
}
